import java.util.Scanner;
public class Demo24 {
    private static Object locker=new Object();
public static void main(String[] args) throws InterruptedException {
    Thread t1 = new Thread(()->{
        System.out.println("t1wait之前");
        synchronized(locker){
            try {
                locker.wait(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("t1wait之后");
    });
    Thread t2=new Thread(()->{
     Scanner scanner = new Scanner(System.in);
     System.out.println("请输入任意内容 唤醒t1");
     scanner.next();
     synchronized(locker){
        locker.notify();     
     }
    });
    t1.start();
    t2.start();
    t1.join();
    t2.join();
}

}
